#!/usr/bin/perl
use File::Recurse;

my $dir= 'C:\Users\Mike\Documents\Wwcom\v3.0\html\templates';
my $cdir= 'C:\Users\Mike\Documents\Wwcom\v3.0\cgi-bin\WiganRL';

my %pms= Recurse([$cdir],{ match => '\.pm$' });

for my $file (<$dir/*.html.old>) {
#	print substr($file,0,length($file)-4)."\n";
	rename $file,substr($file,0,length($file)-4);
}
exit 0;

for my $file (<$dir/*.html>) {
	my $found= 0;
	for my $d (keys %pms) {
		for my $pm (@{$pms{$d}}) {
			open(FID,"$d/$pm");
			my $s= join('',<FID>);
			close(FID);
#			print $s; exit 0;
			if ($s=~ /$file/s) {
				$found= 1;
				last;
			}
			last if ($found);
		}
	}
	if (!$found) {
		print "Unmentioned file: $file - renaming $file.old\n";
		rename $file,"$file.old";
	}
}
